extends Node2D

@onready var animation_player: AnimationPlayer = $AnimationPlayer
@onready var pick_up_area: Area2D = $PickUpArea
signal picked_up
var score_label

func _ready() -> void:
	# 连接到分数标签
	score_label = get_tree().get_first_node_in_group("score_label")
	picked_up.connect(score_label.add)
	animation_player.play("default")
	pick_up_area.area_entered.connect(on_area_entered)

func on_area_entered(area_2d):
	emit_signal("picked_up")
	animation_player.play("pick_up")
